{% extends "base.html" %}
{% block title %}<title>邮件发送</title>{% endblock %}
{% block style %}
     <script type="text/javascript" src='/static/js/wangEditor.min.js'></script>
{% endblock %}
{% block body1 %}{% include "nav.html" %} {% endblock %}
{% block bodyside %}{% endblock %}
{% block bodymain %}
    <h1>{%autoescape off%}{{sendresult}}{% endautoescape %}</h1>
        <br>收件人：<div contenteditable="true" style="border:1px solid #000;width:150px;height:25px" id="sendadress" ></div><br>
        <br>主题：<div contenteditable="true" style="border:1px solid #000;width:150px;height:25px" id="theme" ></div><br>
        <br>正文：<br><div id="content" ></div><br>
<button  id="sumbit">发送</button>
{% endblock %}
{% block script %}<script type="text/javascript">
$(document).ready(function(){
	var E = window.wangEditor;
	var editor = new E('#content');
	editor.create();
	$('#sumbit').click(function(){
		var sendadress = $('#sendadress').html();
		 var theme = $('#theme').html();
		 var content =editor.txt.html();
		 var mail={'sendadress':sendadress,'theme':theme,'content':content};
		$.post("/sendmail",mail,function(data,status){
					alert(data.sendresult);
		});
	});
})
$.ajaxSetup({headers: {"X-CSRFToken": '{{ csrf_token }}'}});
</script>{% endblock %}

